package csoei.bbs.Dao;
import java.sql.*;
public class GuestBookDao {
	private static String sql="";
	private static final String driver="com.mysql.jdbc.Driver";
	private static final String url="jdbc:mysql://localhost:3306/csoeibbs";
	private static final String db_username="root";
	private static final String db_password="666666";
	public static void Add(String username,String email,String content){
		Connection conn=null;Statement stmt=null;
		sql="insert into guestbook(username,email,content) values('"+username+"','"+email+"','"+content+"')";
		try {
			Class.forName(driver);
			try {
				conn=DriverManager.getConnection(url, db_username, db_password);
				stmt=conn.createStatement();
				stmt.execute(sql);
				stmt.close();
				conn.close();
			} catch (SQLException e) {e.printStackTrace();}
		} catch (ClassNotFoundException e){e.printStackTrace();}
	}
}
